package com.example.easytraffic.core;

public class CountBasedTraffic implements Traffic{

	private int times;
	private Traffic traffic;
	private volatile boolean isRunning = true;
	
	public CountBasedTraffic(Traffic traffic, int times) {
		super();
		this.times = times;
		this.traffic = traffic;
	}

	public void run() {
		for (int i = 0; i < times && isRunning; i++) {
			traffic.run();
		}
	}

	public void stop() {
		isRunning = false;
	}

}
